package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.MeetingCollect;
import com.ruoyi.system.service.IMeetingCollectService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 会议收集Controller
 *
 * @author ruoyi
 * @date 2024-04-04
 */
@RestController
@RequestMapping("/system/collect")
public class MeetingCollectController extends BaseController
{
    @Autowired
    private IMeetingCollectService meetingCollectService;

    /**
     * 查询会议收集列表
     */
    @PreAuthorize("@ss.hasPermi('system:collect:list')")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody MeetingCollect meetingCollect)
    {
        setStartPage(meetingCollect.getPageNum(),meetingCollect.getPageSize());
        List<MeetingCollect> list = meetingCollectService.selectMeetingCollectList(meetingCollect);
        return getDataTable(list);
    }


    /**
     * 获取会议收集详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:collect:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(meetingCollectService.selectMeetingCollectById(id));
    }

    /**
     * 新增会议收集
     */
    @PreAuthorize("@ss.hasPermi('system:collect:add')")
    @Log(title = "会议收集", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody MeetingCollect meetingCollect)
    {
        return toAjax(meetingCollectService.insertMeetingCollect(meetingCollect));
    }

    /**
     * 修改会议收集
     */
    @PreAuthorize("@ss.hasPermi('system:collect:edit')")
    @Log(title = "会议收集", businessType = BusinessType.UPDATE)
    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody MeetingCollect meetingCollect)
    {
        return toAjax(meetingCollectService.updateMeetingCollect(meetingCollect));
    }

    /**
     * 删除会议收集
     */
    @PreAuthorize("@ss.hasPermi('system:collect:remove')")
    @Log(title = "会议收集", businessType = BusinessType.DELETE)
	@DeleteMapping("/{id}")
    public AjaxResult remove(@PathVariable Long id)
    {
        return toAjax(meetingCollectService.deleteMeetingCollectById(id));
    }
}
